package com.cnswhy.cloud.server.core.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.cnswhy.cloud.common.core.base.entity.Entity;
import com.cnswhy.cloud.server.common.entity.enumeration.ChannelType;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;

import java.time.LocalDateTime;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 
 * </p>
 *
 * @author cnswhy
 * @since 2021-07-06
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("t_cps_trans_order")
@ApiModel(value = "CpsTransOrder", description = "")
@AllArgsConstructor
public class CpsTransOrder extends Entity<Long> {

    private static final long serialVersionUID = 1L;

    /**
     * 渠道ID
     */
    @ApiModelProperty(value = "渠道ID")
    @Length(max = 20, message = "渠道ID长度不能超过20")
    @TableField(value = "channel_id", condition = LIKE)
    @Excel(name = "渠道ID")
    private String channelId;

    /**
     * 0新增 1 交易中 2 成功  3 失败 4 已过期
     */
    @ApiModelProperty(value = "0新增 1 交易中 2 成功  3 失败 4 已过期")
    @TableField("status")
    @Excel(name = "0新增 1 交易中 2 成功  3 失败 4 已过期")
    private Integer status;

    /**
     * 客户编号
     */
    @ApiModelProperty(value = "客户编号")
    @TableField("customer_id")
    @Excel(name = "客户编号")
    private Long customerId;

    /**
     * 卡号
     */
    @ApiModelProperty(value = "卡号")
    @Length(max = 32, message = "卡号长度不能超过32")
    @TableField(value = "card_id", condition = LIKE)
    @Excel(name = "卡号")
    private String cardId;

    /**
     * 订单号
     */
    @ApiModelProperty(value = "订单号")
    @Length(max = 32, message = "订单号长度不能超过32")
    @TableField(value = "order_id", condition = LIKE)
    @Excel(name = "订单号")
    private String orderId;

    /**
     * 交易金额
     */
    @ApiModelProperty(value = "交易金额")
    @TableField("trans_amt")
    @Excel(name = "交易金额")
    private Long transAmt;

    /**
     * 交易手续费
     */
    @ApiModelProperty(value = "交易手续费")
    @TableField("trans_fee")
    @Excel(name = "交易手续费")
    private Long transFee;

    /**
     * 手续费
     */
    @ApiModelProperty(value = "手续费")
    @TableField("fee")
    @Excel(name = "手续费")
    private Long fee;

    /**
     * 附加手续费
     */
    @ApiModelProperty(value = "附加手续费")
    @TableField("extern_fee")
    @Excel(name = "附加手续费")
    private Long externFee;

    /**
     * 交易费率
     */
    @ApiModelProperty(value = "交易费率")
    @TableField("fee_rate")
    @Excel(name = "交易费率")
    private Long feeRate;

    /**
     * 响应码
     */
    @ApiModelProperty(value = "响应码")
    @Length(max = 32, message = "响应码长度不能超过32")
    @TableField(value = "resp_code", condition = LIKE)
    @Excel(name = "响应码")
    private String respCode;

    /**
     * 响应描述
     */
    @ApiModelProperty(value = "响应描述")
    @Length(max = 255, message = "响应描述长度不能超过255")
    @TableField(value = "resp_desc", condition = LIKE)
    @Excel(name = "响应描述")
    private String respDesc;

    /**
     * 渠道子商户
     */
    @ApiModelProperty(value = "渠道子商户")
    @Length(max = 32, message = "渠道子商户长度不能超过32")
    @TableField(value = "sub_merch_id", condition = LIKE)
    @Excel(name = "渠道子商户")
    private String subMerchId;

    /**
     * 银行
     */
    @ApiModelProperty(value = "银行")
    @Length(max = 255, message = "银行长度不能超过255")
    @TableField(value = "bank_abbr", condition = LIKE)
    @Excel(name = "银行")
    private String bankAbbr;

    /**
     * 登录账号
     */
    @ApiModelProperty(value = "登录账号")
    @Length(max = 255, message = "登录账号长度不能超过255")
    @TableField(value = "mobile", condition = LIKE)
    @Excel(name = "登录账号")
    private String mobile;

    /**
     * 清算日期
     */
    @ApiModelProperty(value = "清算日期")
    @Length(max = 8, message = "清算日期长度不能超过8")
    @TableField(value = "sett_date", condition = LIKE)
    @Excel(name = "清算日期")
    private String settDate;

    /**
     * 客户姓名
     */
    @ApiModelProperty(value = "客户姓名")
    @Length(max = 255, message = "客户姓名长度不能超过255")
    @TableField(value = "cust_name", condition = LIKE)
    @Excel(name = "客户姓名")
    private String custName;

    /**
     * 钱包类型 #ChannelType{LITTLE:小额;LARGE:大额;}
     */
    @ApiModelProperty(value = "钱包类型 #ChannelType{LITTLE:小额;LARGE:大额;}")
    @TableField("channel_type")
    @Excel(name = "钱包类型 #ChannelType{LITTLE:小额;LARGE:大额;}", replace = {"小额_LITTLE", "大额_LARGE",  "_null"})
    private ChannelType channelType;

    @TableField(exist = false)
    private String bankName;
    @Builder
    public CpsTransOrder(Long id, LocalDateTime createTime, LocalDateTime updateTime, Long updateUser, Long createUser, 
                    String channelId, Integer status, Long customerId, String cardId, String orderId, 
                    Long transAmt, Long transFee, Long fee, Long externFee, Long feeRate, String respCode, 
                    String respDesc, String subMerchId, String bankAbbr, String mobile, String settDate, String custName, ChannelType channelType) {
        this.id = id;
        this.createTime = createTime;
        this.updateTime = updateTime;
        this.updateUser = updateUser;
        this.createUser = createUser;
        this.channelId = channelId;
        this.status = status;
        this.customerId = customerId;
        this.cardId = cardId;
        this.orderId = orderId;
        this.transAmt = transAmt;
        this.transFee = transFee;
        this.fee = fee;
        this.externFee = externFee;
        this.feeRate = feeRate;
        this.respCode = respCode;
        this.respDesc = respDesc;
        this.subMerchId = subMerchId;
        this.bankAbbr = bankAbbr;
        this.mobile = mobile;
        this.settDate = settDate;
        this.custName = custName;
        this.channelType = channelType;
    }

}
